//+---------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation, 2008
//
// File: DeliveryServiceConfig.cs
//
// Contents:
//     Provides easy access to the configuration parameters in the [assembly].config file.
//
// Created by:
//     Adam Wardynski (adamwa) Apr 8, 2009
//
//----------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;

namespace Microsoft.Reputation.Services
{
    /// <summary>
    /// Provides easy access to the configuration parameters in the [assembly].config file.
    /// </summary>
    internal class ServiceConfig : ConfigFileBase
    {
        public const string DataProviderTypeDefault = "Microsoft.Reputation.Services.DatabaseDataProvider";
        public const bool PerformanceCounterDisabledDefault = false;
        public const bool EventLoggerDisabledDefault = false;
        public const bool EventLoggerThrottleDisabledDefault = false;
        
        public const int EventLogIntervalInMillisecondsDefault = 60 * 60 * 1000; // 1 hour        

        public const string PerformanceCounterDisabledKey = "performanceCounterDisabled";
        public const string EventLoggerDisabledKey = "eventLoggerDisabled";
        public const string EventLoggerThrottleDisabledKey = "eventLoggerThrottleDisabled";
        public const string EventLogIntervalInMillisecondsKey = "EventLogIntervalInMilliseconds";
        public const string LookupCachingExpirationInSecondsKey = "LookupCachingExpirationInSeconds";

        public static bool PerformanceCounterDisabled
        {
            get
            {
                return GetParameterValue(PerformanceCounterDisabledKey, PerformanceCounterDisabledDefault);
            }
        }

        public static bool EventLoggerDisabled
        {
            get
            {
                return GetParameterValue(EventLoggerDisabledKey, EventLoggerDisabledDefault);
            }
        }

        public static bool EventLoggerThrottleDisabled
        {
            get
            {
                return GetParameterValue(EventLoggerThrottleDisabledKey, EventLoggerThrottleDisabledDefault);
            }
        }

        public static int EventLogIntervalInMilliseconds
        {
            get
            {
                return GetParameterValue(
                    EventLogIntervalInMillisecondsKey,
                    EventLogIntervalInMillisecondsDefault,
                    0,
                    int.MaxValue);
            }
        }
    }
}
